import { list } from './../service/dva';

export default {
  namespace: 'dvaDemo',
  state: {
    list: ''
  },
  effects: {
    *list({ payload, callback }, { put, call }) {
      const response = yield call(list, payload);
      yield put({
        type: 'listInfo',
        payload: response
      })
      if (callback) {
        callback(response);
      }
    }
  },

  reducers: {
    listInfo: (state, action) => {
      return {
        ...state,
        list: action.payload
      }
    }
  }
}